package com.controller;

import com.filter.MyHttpSessionListener;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class MyController {

    @RequestMapping("hello")
    public String hello(HttpSession session) {

        //监听session对象，发生改变，online+1
        session.setAttribute("aa","aa");
        return "hello";
    }

    @RequestMapping("online")
    public String online(){
        return "当前在线人数："+ MyHttpSessionListener.online+"人";
    }

}
